// site.isscloud.project.service.impl.PjRealtimeTemperatureDataIssueServiceImpl.java
package site.isscloud.project.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import site.isscloud.project.domain.PjRealtimeTemperatureDataIssue;
import site.isscloud.project.mapper.PjRealtimeTemperatureDataIssueMapper;
import site.isscloud.project.service.IPjRealtimeTemperatureDataIssueService;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 实时温度异常数据Service业务层处理
 */
@Service
public class PjRealtimeTemperatureDataIssueServiceImpl implements IPjRealtimeTemperatureDataIssueService {
    @Autowired
    private PjRealtimeTemperatureDataIssueMapper pjRealtimeTemperatureDataIssueMapper;

    /**
     * 查询实时温度异常数据
     */
    @Override
    public PjRealtimeTemperatureDataIssue selectPjRealtimeTemperatureDataIssueById(Long id) {
        return pjRealtimeTemperatureDataIssueMapper.selectPjRealtimeTemperatureDataIssueById(id);
    }

    /**
     * 查询实时温度异常数据列表
     */
    @Override
    public List<PjRealtimeTemperatureDataIssue> selectPjRealtimeTemperatureDataIssueList(PjRealtimeTemperatureDataIssue pjRealtimeTemperatureDataIssue) {
        return pjRealtimeTemperatureDataIssueMapper.selectPjRealtimeTemperatureDataIssueList(pjRealtimeTemperatureDataIssue);
    }

    /**
     * 新增实时温度异常数据
     */
    @Override
    public int insertPjRealtimeTemperatureDataIssue(PjRealtimeTemperatureDataIssue pjRealtimeTemperatureDataIssue) {
        return pjRealtimeTemperatureDataIssueMapper.insertPjRealtimeTemperatureDataIssue(pjRealtimeTemperatureDataIssue);
    }

    /**
     * 修改实时温度异常数据
     */
    @Override
    public int updatePjRealtimeTemperatureDataIssue(PjRealtimeTemperatureDataIssue pjRealtimeTemperatureDataIssue) {
        return pjRealtimeTemperatureDataIssueMapper.updatePjRealtimeTemperatureDataIssue(pjRealtimeTemperatureDataIssue);
    }

    /**
     * 批量删除实时温度异常数据
     */
    @Override
    public int deletePjRealtimeTemperatureDataIssueByIds(Long[] ids) {
        return pjRealtimeTemperatureDataIssueMapper.deletePjRealtimeTemperatureDataIssueByIds(ids);
    }

    /**
     * 删除实时温度异常数据信息
     */
    @Override
    public int deletePjRealtimeTemperatureDataIssueById(Long id) {
        return pjRealtimeTemperatureDataIssueMapper.deletePjRealtimeTemperatureDataIssueById(id);
    }

    /**
     * 保存异常温度数据
     */
    @Override
    public void saveAbnormalTemperatureData(String deviceNo, Integer channelNo, Integer meter,
                                            BigDecimal maxTemperature, BigDecimal minTemperature, Date createTime) {
        PjRealtimeTemperatureDataIssue issueData = new PjRealtimeTemperatureDataIssue();
        issueData.setDeviceNo(deviceNo);
        issueData.setChannelNo(channelNo);
        issueData.setMeter(meter);
        issueData.setMaxTemperatures(maxTemperature);
        issueData.setMinTemperatures(minTemperature);
        issueData.setCreateTime(createTime);

        pjRealtimeTemperatureDataIssueMapper.insertPjRealtimeTemperatureDataIssue(issueData);
    }
}